package com.gt.controller;

import com.gt.mapper.MenuMapper;
import com.gt.pojo.Menu;
import com.gt.service.MenuService;
import com.gt.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/sys")
public class MenuController {
    @Autowired
    private MenuService menuService;

    /**
     * 查询所有菜单
     * 改进:
     *      数据不变,最后需要存进redis,或者开启二级缓存
     * @return
     */
    @RequestMapping("/menu")
    public SysResult findMenu(){
        //查询所有菜单
        List<Menu> menuList = menuService.findMenu();
        return SysResult.success(menuList);
    }
}
